<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
 
	<link  rel="stylesheet" type="text/css" href="css/navigator.css" />
	<script type="text/javascript" language="javascript" src="js/jquery-1.7.1.js"></script>
	<script>
		$(function(){
			$('input[value="add"]').click(function(){
				 
			});
			
			$('input[value="delete"]').click(function(){
				var i=$('input:checked').length;
				var url='deleteProject?';
				if(i<1){
					alert('please choose at least one project!');
				}else{
				
					$('input:checked').each(function(){
						url=url+'pid='+$(this).attr('value')+'&';
						//前台“删除”数据
						$(this).parent().parent().hide();
					});
					url=url.slice(0,-1);
					//后台删除数据
					$.ajax({
				  url: targetURL,
				  cache: false
				}).done(function( html ) {
				  $(".body_left").html(html);
					  
				});	
				}
				
			});
			
			$('input[value="detail"]').click(function(){
				alert('3');
			});
		});
	</script>
  </head>
  
  <body>
  	<span>projects list:</span>
	<br/>
	<table border="1">
		<tr>
			<td>
				choose
			</td>
			<td>
				project name
			</td>
			<td>
				description
			</td>
			<td>
				create time
			</td>
		</tr>
		<s:iterator value="projectList" id="list" status="st">
		<tr>
			<td>
				<input  type="checkbox" value='<s:property value="#list.pid" /> ' />
			</td>
			<td>
				<s:property value="#list.title" /> 
			</td>
			<td>
				<s:property value="#list.description" /> 
			</td>
			<td>
				<s:property value="#list.time" /> 
			</td>
		</tr>
		</s:iterator>
	</table>
	
	<tr>
		<input type="button" value='add' />
		<input type="button" value='delete' />
		<input type="button" value='detail' />
	</tr>
  </body>
</html>
